<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/11/28
 * Time: 13:51
 */
namespace App\Http\Controllers\Home;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\StockReward;
use App\Models\StockOrder;
use Auth;
class StockOrderController extends Controller
{
    /*
     * 统计获奖总金额
     * $id活动id号
     * */
    public function index(Request $request){
        $user = Auth::user();
        $orders = StockOrder::where('user_id',$user->id)->where('status',1)->orderBy('id','desc')->simplePaginate(5);
        return view('home.stockorder.index',compact('orders'));
    }

    public function rewardOrder(Request $request){
        $user = Auth::user();
        $orders = StockOrder::where('user_id',$user->id)
            ->where('status',1)
            ->whereHas('hasReward')
            ->orderBy('id','desc')
            ->simplePaginate(5);
        return view('home.stockorder.reward_order',compact('orders'));
    }

}